import App from './App'
import topNavBarVue from './components/top-nav-bar.vue'
import footPage from './components/foot-page.vue'
import cbInput from './components/cb-input.vue'
import messages from './locale/index'

const i18nConfig = {
  // locale: uni.getLocale(),
  locale: 'korea',
  messages
}

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
import VueI18n from 'vue-i18n'

Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  i18n,
  ...App
})
app.component('top-nav-bar', topNavBarVue)
app.component('foot-page', footPage)
app.component('cb-input', cbInput)
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'

const t = createI18n(i18nConfig)
export function createApp() {
  const app = createSSRApp(App)
  app.component('top-nav-bar', topNavBarVue)
  app.component('foot-page', footPage)
  app.component('cb-input', cbInput)
  app.use(t)
  return {
    app
  }
}
// #endif
